<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * @author Anh Nguyen <duyanhnguyen@vccorp.vn>
 * @copyright 2012
 */

class Admin_Layout
{
    private $_CI;

    function __construct()
    {
        $this->_CI =& get_instance();
        $this->_CI->load->library('Minifier');
        $this->_CI->load->library('Blockcache');
    }
    
    public function _loadHeader($headTitle = '')
    {
        $data = array();
        $data['headTitle'] = $headTitle;
        $this->addCssJs();
        $data['combinedCss'] = $this->_CI->minifier->GetCombined('css');
        $data['combinedJs'] = $this->_CI->minifier->GetCombined('js');
        $this->_CI->load->view('header_view',$data);
    }
    
    public function _loadFooter()
    {
        $this->_CI->load->view('footer_view');
    }
    
    public function _loadLeftMenu()
    {
        $this->_CI->load->view('leftmenu_view');
    }
    
    private function addCssJs()
    {
        $this->_CI->minifier->AddCss('screen');
        $this->_CI->minifier->AddCss('tipsy');
        $this->_CI->minifier->AddCss('datepicker');
        $this->_CI->minifier->AddJs('jquery-1.7.min');
        $this->_CI->minifier->AddJs('jquery.validate');
        $this->_CI->minifier->AddJs('jquery-ui-1.7.1.custom.min');
        $this->_CI->minifier->AddJs('hint');
        $this->_CI->minifier->AddJs('visualize/jquery.visualize');
        $this->_CI->minifier->AddJs('jwysiwyg/jquery.wysiwyg');
        $this->_CI->minifier->AddJs('fancybox/jquery.fancybox-1.3.0');
        $this->_CI->minifier->AddJs('custom_black');
        $this->_CI->minifier->AddJs('jquery.tipsy');
        $this->_CI->minifier->AddJs('jquery.img.preload');
       	
    }
    
    public function view($viewFile, $data = array())
    {
        $headTitle = (isset($data['headTitle'])) ? $data['headTitle'] : '';
        $this->_loadHeader($headTitle);
        $this->_loadLeftMenu();
        $this->_CI->load->view($viewFile, $data);
        $this->_loadFooter();
    }

}

?>